namespace Warehouse

open System.Windows.Controls
open System.Windows.Data
open FSharp.Windows
open Warehouse.Controls

type MainEvents = 
    | Brands
    | NewProduct
    | NewClient
    | NewVendor
    | NewInvoice
    | NewPurchaseOrder

    | InvoicesReport
    | PurchaseOrdersReport
    | CatalogReport

    | CompanyInfo

type MainView(?mainWindow) = 
    inherit View<MainEvents, MainModel, MainWindow>(?window = mainWindow)

    override this.EventStreams = 
        [   
            this.Control.Brands, Brands
            this.Control.NewProduct, NewProduct
            this.Control.NewClient, NewClient
            this.Control.NewVendor, NewVendor
            this.Control.NewInvoice, NewInvoice
            this.Control.NewPurchaseOrder, NewPurchaseOrder

            this.Control.InvoicesReport, InvoicesReport
            this.Control.PurchaseOrdersReport, PurchaseOrdersReport
            this.Control.CatalogReport, CatalogReport

            this.Control.CompanyInfo, CompanyInfo
        ]
        |> List.map MenuItem.ClickToValue

    override this.SetBindings model = 
        Binding.FromExpression 
            <@ 
                this.Control.DatabaseServer.Text <- model.DatabaseServer
                this.Control.ProgramVersion.Text <- model.ProgramVersion
            @>



